package com.jumi.microservice.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumi.microservice.entity.JmAddress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 买家地址信息表 Mapper 接口
 * </p>
 *
 * @author 要挑客户管理团队
 * @since 2020-09-08
 */
public interface JmAddressMapper extends BaseMapper<JmAddress> {
    Page getPage(Page page,@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("select address_id,uid,true_name,area_info,address,mob_phone,is_default" +
            ",area_id,city_id,province_id from jm_address where is_default=0 and uid=#{uid}" +
            " order by address_id desc limit 1")
    JmAddress findMaxNotDefaultObj(@Param("uid")Integer uid);
}
